<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <login></login>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>

    const login= {
        template: "<div><input type='button' value='点我' @click='change'></input></div>",
        data()
        {
            return {msg:"我"}
        },
        //this 指子组件对象
        methods: {
            change:function () {
              alert("成功啦！"+this.msg)
            }
        }
    }


    const app = new Vue(
        {
            el: "#app",
            data: {},
            methods: {},
            components:{
                login
            }
        }
    )
</script>
</body>
</html>